Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs sub-commands #4881

Merged
merged 25 commits into from
Mar 27, 2023
Merged

Add docs sub-commands #4881

merged 25 commits into from
Mar 27, 2023

Conversation

mildaniel
Copy link
Contributor

@mildaniel mildaniel commented Mar 16, 2023

Which issue(s) does this change fix?

N/A

Why is this change necessary?

Makes the sam docs command more useful by providing invokable sub-commands to open more specific pages.
For example, the documentation for each command and its sub-commands is now retrievable with:

sam docs build
sam docs local
sam docs local invoke
...

and even non-commands like sam docs config.

What side effects does this change have?

N/A

Mandatory Checklist

PRs will only be reviewed after checklist is complete

  • Add input/output type hints to new functions/methods
  • Write design document if needed (Do I need to write a design document?)
  • Write/update unit tests
  • Write/update integration tests
  • Write/update functional tests if needed
  • make pr passes
  • make update-reproducible-reqs if dependencies were changed
  • Write documentation

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

self.command_string = self.docs_command.sub_command_string
self.command_callback = self.docs_command.command_callback

def get_command(self, ctx: Context, cmd_name: str) -> Command:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does --help text look like?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the new formatters to format the help text. Looks like this for the base command and all sub-commands.

image

@mildaniel mildaniel marked this pull request as ready for review March 21, 2023 00:49
@mildaniel mildaniel requested a review from a team as a code owner March 21, 2023 00:49
@@ -0,0 +1,21 @@
{
"config": "https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-config.html",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of repetitive URLs here but I left it this way since we have no way of guaranteeing that new URLs will have the same pattern. It also just keeps the configuration easy instead of trying to parse patterns for different types of URLs in our documentation.

samcli/lib/docs/documentation.py Show resolved Hide resolved
samcli/lib/docs/documentation.py Outdated Show resolved Hide resolved
Copy link
Contributor

@moelasmar moelasmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me. I just left some minor comments and questions, but I do not think it should block the PR

@mildaniel mildaniel added this pull request to the merge queue Mar 27, 2023
Merged via the queue into aws:develop with commit ad5f359 Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants